

import pymysql
import pymysql.cursors

if __name__ == '__main__':
    with pymysql.connect(host="localhost",port=3308,db="java86school",user="root",password="root1234") as con:
        cursor=con.cursor()
        sql="""
            insert into s_student(sname,qq,gradeid,enterdate)
            values('尼古拉.赵武','33311444',1,'2025-7-16')
        """#ACID
        r=cursor.execute(sql)
        print(f"增加了{r}行")
        con.commit()#提交 事务

